package org.shoukaiseki.aqoeous.exception;


import org.shoukaiseki.aqoeous.convert.Base62Decimal;

import java.sql.ResultSet;
import java.text.MessageFormat;

/**
 * org.shoukaiseki.aqoeous.exception.ResultException
 * <br>
 *
 * @author shoukaiseki ブログ http://www.shoukaiseki.top/<br> E-メール jiang28555@Gmail.com<br>
 * @date 2020-12-10 21:40:48<br>
 */
public class ResultException extends RuntimeException   {


    /**
     * 低位多少之后为分组位<br>
     *  左移 GROUP_BIT 位作为分组位
     */
    public static final Integer GROUP_BIT=12;

    private String msg;

    private String[] params=null;


    public ResultException(String msg) {
        super("");
        this.msg=msg;
    }

    public ResultException(String msg, Throwable t) {
        super("",t);
        this.msg=msg;
    }


    public ResultException format(Object... objects){
        msg=MessageFormat.format(msg,objects);
        return this;
    }


    @Override
    public String getMessage() {
        if (getCause() != null&&getCause() instanceof ResultException&& getCause().getMessage()!=null) {
            return msg + getCause().getMessage();

        } else {
            return msg;
        }
    }

}

